home *** CD-ROM | disk | FTP | other *** search
- property spriteNum, pDart, pLoc, pDistanceFromBoard, pBoardHeightFromGround, pPower, pDeterMinePower, pGravity, pair, pDiffer, pScale, pHeightOfDart, pOgHeight, pOgWidth, pFollow, hateV, hateH, myOloc, myOh, myOv, myOr
- global gDartCount, gEnableGrab, gEnablethrow, gIB, gBscreen, gDartPoint, gCRBox, gTargets, gDartButtons, gRound, gCurrentScore, gRoundScore, gCSBox, gRSBox, gDartScore, gCurrentSector, gGotDouble, pootimer, gDartList, pseudoList
-
- on beginSprite me
- gDartList.add(spriteNum)
- myOloc = sprite(spriteNum).loc
- myOh = sprite(spriteNum).height
- myOv = sprite(spriteNum).width
- myOr = sprite(spriteNum).rotation
- sprite(spriteNum).ink = 8
- sprite(spriteNum).member.alphaThreshold = 0
- end
-
- on cleanUp me
- sprite(spriteNum).loc = myOloc
- sprite(spriteNum).height = myOh
- sprite(spriteNum).width = myOv
- sprite(spriteNum).rotation = myOr
- end
-
- on init me
- pDart = sprite(spriteNum)
- pDistanceFromBoard = 96
- pBoardHeightFromGround = 68
- pGravity = 0.59999999999999998
- pHeightOfDart = 28
- pOgHeight = pDart.height
- pOgWidth = pDart.width
- pFollow = timeout("follow").new(1, #followMouse, me)
- pair = VOID
- end
-
- on followMouse me
- if (the mouseH >= 0) and (the mouseH <= (the stage).rect.width) and ((the mouseV >= 250) and (the mouseV <= (the stage).rect.height)) then
- pDart.loc = the mouseLoc
- else
- pDart.locH = the mouseH
- end if
- end
-
- on mouseDown me
- if voidp(pair) and (pDistanceFromBoard > 0) then
- gEnablethrow = 1
- pFollow.forget()
- pLoc = []
- pLoc[1] = pDart.locH
- pLoc[2] = pDart.locV
- pDistanceFromBoard = 96
- pHeightOfDart = 28
- pDeterMinePower = timeout("power" & string(spriteNum)).new(5, #buildPower, me)
- end if
- end
-
- on mouseUp me
- if gEnablethrow and (pDistanceFromBoard > 0) then
- puppetSound(4, member("throw dart"))
- gEnablethrow = 0
- hateH = the mouseH
- hateV = the mouseV
- pDartsCount = pDartsCount + 1
- pDeterMinePower.forget()
- buildPower()
- pair = timeout("pAir" & string(spriteNum)).new(5, #thrown, me)
- end if
- end
-
- on mouseUpOutSide me
- if gEnablethrow and (pDistanceFromBoard > 0) then
- puppetSound(4, member("throw dart"))
- gEnablethrow = 0
- hateH = the mouseH
- hateV = the mouseV
- pDartsCount = pDartsCount + 1
- pDeterMinePower.forget()
- buildPower()
- pair = timeout("pAir" & string(spriteNum)).new(10, #thrown, me)
- end if
- end
-
- on buildPower me
- pPower = -((float(hateV) - pLoc[2]) * 0.17999999999999999) * 0.72999999999999998
- pDiffer = -((float(hateH) - pLoc[1]) * 0.17999999999999999) * 0.72999999999999998
- if pPower < 10 then
- pPower = 10
- end if
- if pPower > 22 then
- pPower = 22
- end if
- end
-
- on thrown me
- pDart.height = pDart.height - 3.54999999999999982
- pDart.width = pDart.width - 3.54999999999999982
- pDart.rotation = pDart.rotation + (pPower * 1.30000000000000004)
- pPower = pPower - pGravity
- pDistanceFromBoard = float(pDistanceFromBoard) - 2.5
- pHeightOfDart = pHeightOfDart + pPower
- pLoc[2] = pLoc[2] - pPower
- pLoc[1] = pLoc[1] - pDiffer
- pDart.locV = pLoc[2]
- pDart.locH = pLoc[1]
- pLoc[2] = pDart.locV
- pLoc[1] = pDart.locH
- if pDistanceFromBoard <= 0 then
- if pDart.locV < 440 then
- og = [290.0, 220.0]
- pd = [pDart.locH.float, pDart.locV.float]
- vec = [pd[1] - og[1], pd[2] - og[2]]
- veclen = sqrt((vec[1] * vec[1]) + (vec[2] * vec[2]))
- if veclen > 190 then
- puppetSound(4, member("dart hit"))
- else
- puppetSound(4, member("dart hit 2"))
- end if
- else
- puppetSound(4, member("hit floor"))
- end if
- pair.forget()
- gDartPoint.loc = pDart.loc
- repeat with i = 1 to gTargets.count
- updateStage()
- if not gGotDouble then
- if gDartPoint.intersects(gTargets[i]) then
- if sprite(gTargets[i]).pMultiply = 2 then
- gGotDouble = 1
- member("current sector").text = string(gCurrentSector)
- pseudoList = []
- repeat with i = 1 to gTargets.count
- if sprite(gTargets[i]).pSector = gCurrentSector then
- pseudoList.add(gTargets[i])
- end if
- if pseudoList.count = 4 then
- blinkLikeTheDickens()
- end if
- end repeat
- end if
- end if
- next repeat
- end if
- if gGotDouble then
- if sprite(gTargets[i]).pSector = gCurrentSector then
- if gDartPoint.intersects(gTargets[i]) then
- if sprite(gTargets[i]).pSector = gCurrentSector then
- gCurrentScore = gCurrentScore + sprite(gTargets[i]).returnPoints()
- gCSBox.text = string(gCurrentScore)
- gCurrentSector = gCurrentSector + 1
- gRoundScore[gRound] = string(gRoundScore[gRound] + sprite(gTargets[i]).returnPoints())
- gRSBox[gRound].text = string(gRoundScore[gRound])
- gDartScore[gDartCount] = string(sprite(gTargets[i]).returnPoints())
- if gRound <= 20 then
- pseudoList = []
- repeat with i = 1 to gTargets.count
- if sprite(gTargets[i]).pSector = gCurrentSector then
- pseudoList.add(gTargets[i])
- end if
- if pseudoList.count = 4 then
- blinkLikeTheDickens()
- end if
- end repeat
- end if
- if gCurrentSector = 21 then
- pootimer = timeout("yyy").new(1000, #gameEnd, me)
- next repeat
- end if
- member("current sector").text = string(gCurrentSector)
- end if
- end if
- end if
- end if
- end repeat
- member("dart" && string(gDartCount)).text = string(gDartScore[gDartCount])
- gEnableGrab = 1
- if gDartCount = 3 then
- gRSBox[gRound].text = string(gRoundScore[gRound])
- if gCurrentSector <> 21 then
- gBscreen = timeout("bscreen").new(800, #bscreen, me)
- end if
- end if
- end if
- end
-
- on bscreen me
- gBscreen.forget()
- gDartCount = 0
- gRound = gRound + 1
- gDartScore = [0, 0, 0]
- gCRBox.text = string(gRound)
- repeat with i = 1 to 3
- member("dart" && string(i)).text = "0"
- end repeat
- repeat with i = 1 to gDartList.count
- sprite(gDartList[i]).cleanUp()
- end repeat
- repeat with i = 1 to gDartButtons.count
- sprite(gDartButtons[i]).visible = 1
- end repeat
- repeat with i = 1 to gIB.count
- sprite(gIB[i]).cleanUp()
- end repeat
- if gRound <= 20 then
- if member("Current Sector").text <> "Double" then
- pseudoList = []
- repeat with i = 1 to gTargets.count
- if sprite(gTargets[i]).pSector = gCurrentSector then
- pseudoList.add(gTargets[i])
- end if
- if pseudoList.count = 4 then
- blinkLikeTheDickens()
- end if
- end repeat
- end if
- end if
- if gRound > 20 then
- gameEnd()
- end if
- end
-
- on gameEnd me
- go("game over")
- end
-